package 设计原则;

public class Father {

    public void fun(int a, int b) {
        System.out.println(a + "+" + b + "=" + (a + b));
    }
}

class Son extends Father {

    @Override
    public void fun(int a, int b) {
        System.out.println(a + "-" + b + "=" + (a - b));
    }
}


class Client {

    public static void main(String[] args) {
        Father father = new Father();
        System.out.println("父类运行结果：");
        father.fun(1, 2);//1+2=3

        System.out.println("子类替代父类后的运行结果：");
        Son son = new Son();
        son.fun(1, 2);//1-2=-1
    }
}